package com.llc.mall.auth.infrastructure.persist.repositoryimpl;

import com.llc.mall.auth.domain.user.entity.User;
import com.llc.mall.auth.domain.user.repository.UserRepository;
import com.llc.mall.auth.infrastructure.persist.mapper.AuthAccountMapper;
import com.llc.mall.common.security.bo.AuthAccountInVerifyBO;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class UserRepositoryImpl implements UserRepository {


    @Resource
    private AuthAccountMapper authAccountMapper;


    @Override
    public User findById(Long userId) {
        return null;
    }

    @Override
    public User findUserByName(String userName) {
        AuthAccountInVerifyBO authAccountInVerifyBO = authAccountMapper.getAuthAccountInVerifyByInputUserName(1, userName, 1);
        return User.builder()
                .id(authAccountInVerifyBO.getUserId())
                .status(authAccountInVerifyBO.getStatus())
                .sysType(authAccountInVerifyBO.getSysType())
                .password(authAccountInVerifyBO.getPassword())
                .uid(authAccountInVerifyBO.getUid())
                .build();
    }
}
